//
//  RuleViewController.m
//  ShrimpCrowdordering
//
//  Created by jimmy on 2018/9/14.
//  Copyright © 2018年 郑洲. All rights reserved.
//

#import "RuleViewController.h"

@interface RuleViewController ()<UITextViewDelegate>

@property (nonatomic,strong)  UITextView  * textView;

@end

@implementation RuleViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    
    [self setTitle:@"提现规则"];
    
    [self setViewUI];
    [self getData];
}

- (void)setViewUI
{
    self.textView = [[UITextView alloc] init];
    self.textView.backgroundColor = [UIColor whiteColor];
    self.textView.frame = CGRectMake(ScreenX375(10), ScreenX375(10), SCREEN_WIDTH - ScreenX375(20), SCREEN_HEIGHT - NAVIGATION_BAR_HEIGHT);
    self.textView.textColor = UIColorFromRGB(@"#212121", 1);
    self.textView.font = Kfont(14);
//    self.textView.text = @"提现将三个工作日到期，周六日不打款提现将三个工作日到期，周六日不打款提现将三个工作日到期，周六日不打款提现将三个工作日到期，周六日不打款提现将三个工作日到期，周六日不打款提现将三个工作日到期，周六日不打款提现将三个工作日到期，周六日不打款";
    self.textView.editable = NO; // 默认YES
    [self.view addSubview:self.textView];
    
}

-(void)getData
{
    [HttpManager postHttpRequestByGet:[NSString stringWithFormat:@"%@api/listRuleExplain",REQUESTHEADER] andParameter:nil success:^(id successResponse) {
        NSString *status = [NSString stringWithFormat:@"%@",successResponse[@"code"]];
        if ([status isEqualToString:@"200"]) {
            NSArray *array = [NSArray array];
            array = successResponse[@"data"][@"rules"];
            NSMutableArray *tempArr = [NSMutableArray array];
            for (int i = 0; i < array.count; i ++) {
                NSDictionary *dict = array[i];
                NSString *str = [dict valueForKey:@"ruleName"];
                [tempArr addObject:str];
            }
            
            NSString *str = [tempArr componentsJoinedByString:@"\n"];
            self.textView.text = str;
            
        }else {
            [HttpManager showNoteMsg:[NSString stringWithFormat:@"%@",successResponse[@"msg"]]];
        }
    } andFailure:^(id failureResponse) {
        [HttpManager showFail];
    }];
}



@end
